#include <stdio.h>
#include <unistd.h>

#include "help/query.h"

// When trying to open for read while writing
// then program crashes
// TODO: fix it pls

int main(int argc, char* argv[]) {
    if (argc < 3) {
        return 1;
    }

    unsigned user_id = (unsigned)atoi(argv[1]);
    unsigned unit_id = (unsigned)atoi(argv[1]);

    char* root = getenv("RELAT_ROOT");

    double x = 0, y = 0, z = 0;
    for (;;) {
        get_unit_position(root, unit_id, &x, &y, &z);
        printf("%.3f %.3f %.3f\n", x, y, z);

        sleep(0.1);
    }

    return 0;
}